import { useAPIUtils } from "@/components/APIUtilsProvider";

function Text({ dictName, keyName }) {
  const { tanstackQuery } = useAPIUtils();
  const query = tanstackQuery(`/dictionaries/${dictName}`);

  return (
    <>
      {query.data && query.data[keyName] ? query.data[keyName].text : keyName}
    </>
  );
}

export { Text };
